package com.tuanzi.loan.core.util;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;

import org.apache.commons.lang3.StringUtils;

/**
 * @author Ray 2017/09/21
 */
public class ThrowableUtils {

	public static String getStackTraceString(Throwable t) {
		try (StringWriter sw = new StringWriter()) {
			t.printStackTrace(new PrintWriter(sw, true));
			return sw.getBuffer().toString();
		} catch (IOException e) {
			return StringUtils.EMPTY;
		}
	}
}
